<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<script type="text/javascript">
	var i = 1;
	function change(){
		setInterval("changeFun()", 1000);
	}

	function changeFun(){	
		i %= 3;
		++i;
		//i = parseInt(((Math.random()*10000000000000000) % 3) +1);
		document.getElementById("img_body").src = (i+".jpg");
	}
	
</script>

<body onclick="change()">
	<img id="img_body" src="1.jpg">
</body>
</html>